<template>
  <div>
    <p style="width: 100%; text-align: center; font-weight: bold; font-size: 20px">12商品入库单</p>
    <a-divider />
    <a-descriptions title="" size="small">
      <a-descriptions-item label="调入" :span="2"> {{ info?.inStoreName }} </a-descriptions-item>
      <a-descriptions-item label="编号" :span="2"> {{ info?.id }} </a-descriptions-item>
      <a-descriptions-item label="调库日期" :span="2"> {{ info?.outDate }} </a-descriptions-item>
      <a-descriptions-item label="调库店面" :span="2"> {{ info?.outStoreName }} </a-descriptions-item>
    </a-descriptions>
    <table
      class="yk-table"
      border="1pm"
      cellspacing="0"
      align="center"
      width="100%"
      style="font-size: 12px; font-family: SimSun; table-layout: fixed; word-wrap: break-word; word-break: break-all"
    >
      <tr align="center" style="font-weight: bold">
        <th>商品</th>
        <th>单价</th>
        <th>数量</th>
        <th>金额</th>
      </tr>
      <tr v-for="(item, index) in list" :key="index" align="center">
        <td>{{ item.goodName }}</td>
        <td>{{ item.adAmount }}</td>
        <td>{{ 1 }}</td>
        <td>{{ item.adAmount * 1 }}</td>
      </tr>
      <tr align="center">
        <td>合计</td>
        <td></td>
        <td>{{ this.list?.map((itm) => {  
        return 1}).reduce((prev, cur) => {  
          return prev + cur;
          }).toFixed(0) 
        }}
        </td>
        <td>{{ this.list?.map((itm) => {  
        return itm?.adAmount ?? 0;}).reduce((prev, cur) => {  
          return prev + cur;
          }).toFixed(0) 
        }}
        </td>
        <!-- <td /> -->
      </tr>
    </table>
    <a-divider />
    <a-descriptions title="" size="small">
      <a-descriptions-item label="调库人" :span="2"> {{ info?.empName }} </a-descriptions-item>
      <a-descriptions-item label="审核人" :span="2"> {{ info?.checkerName }} </a-descriptions-item>
    </a-descriptions>
    <!-- <a-table 
      ref="table" 
      size="default" 
      rowKey="key"  
      :pagination="false" 
      :columns="columns" 
      :data-source="list">
      <span slot="serial" slot-scope="text, record, index">
        {{ index + 1 }}
      </span>
    </a-table> -->
  </div>
</template>
  
  <script>
export default {
  name: '',
  props: {
    list: {
      type: Array,
      default: () => null,
    },
    info: {
      type: Object,
      default: () => null,
    },
  },
}
</script>
<style lang="less" scoped>
@page {
  size: auto;
  margin: 3mm;
}
html {
  background-color: #ffffff;
  margin: 0px;
}
body {
  border: solid 1px #ffffff;
}
</style>